home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _IEErrorHandlerRegister.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  43 lines

  1. ; *******************************************************
  2. ; Example 1 - Register and later deregister a custom and the default IE.au3 error handler
  3. ; *******************************************************
  4. ;
  5. #include <IE.au3>
  6. ; Register a customer error handler
  7. _IEErrorHandlerRegister ("MyErrFunc")
  8. ; Do something
  9. ; Deregister the customer error handler
  10. _IEErrorHandlerDeregister ()
  11. ; Do something else
  12. ; Register the default IE.au3 COM Error Handler
  13. _IEErrorHandlerRegister ()
  14. ; Do more work
  15.  
  16. Exit
  17.  
  18. Func MyErrFunc()
  19.     ; Important: the error object variable MUST be named $oIEErrorHandler
  20.     $ErrorScriptline = $oIEErrorHandler.scriptline
  21.     $ErrorNumber = $oIEErrorHandler.number
  22.     $ErrorNumberHex = Hex($oIEErrorHandler.number, 8)
  23.     $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2)
  24.     $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2)
  25.     $ErrorSource = $oIEErrorHandler.Source
  26.     $ErrorHelpFile = $oIEErrorHandler.HelpFile
  27.     $ErrorHelpContext = $oIEErrorHandler.HelpContext
  28.     $ErrorLastDllError = $oIEErrorHandler.LastDllError
  29.     $ErrorOutput = ""
  30.     $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
  31.     $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
  32.     $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
  33.     $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
  34.     $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
  35.     $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
  36.     $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
  37.     $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
  38.     $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
  39.     $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
  40.     MsgBox(0,"COM Error", $ErrorOutput)
  41.     SetError(1)
  42.     Return
  43. EndFunc  ;==>MyErrFunc